package by.ins.webconsole.jsf.actions;

import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;

import by.ins.app.App;
import by.ins.app.AppContext;
import by.yativem.commons.task.AbstractManagedTask;


@ManagedBean
@ApplicationScoped
public class AppActions extends ActionSupport {

	public String startApp(){	
		App app = AppContext.getApp();
		if( app.getTaskStatus() != AbstractManagedTask.TaskStatus.NO_STARTED){
			return RESULT_ERROR;
		}else{
			app.startApp();
		}
		return RESULT_SUCCESS;
	}
	
	public boolean canStarted(){
		return AppContext.getApp().getTaskStatus().equals( AbstractManagedTask.TaskStatus.NO_STARTED );
	}
	
}
